import request from '../request'
import globalConfig from "../config";

// 查询用户列表
export function getArticles(params) {
    return request({
        url: `${globalConfig.getAPIPath()}${globalConfig.vblog.articleList}`,
        method: 'get',
        params: params
    })
}


export function getHotArtices() {
  return request({
    url: `${globalConfig.getAPIPath()}${globalConfig.vblog.articleList}`,
    method: 'get'
  })
}

export function getNewArtices() {
  return request({
    url: `${globalConfig.getAPIPath()}${globalConfig.vblog.articleList}`,
    method: 'get'
  })
}

export function viewArticle(id) {
  return request({
    url: `${globalConfig.getAPIPath()}${globalConfig.vblog.articleInfo}/${id}`,
    method: 'get'
  })
}

export function getArticleById(id) {
  return request({
    url: `${globalConfig.getAPIPath()}${globalConfig.vblog.articleInfo}/${id}`,
    method: 'get'
  })
}

export function updateArticle(article) {
  return request({
    url: `${globalConfig.getAPIPath()}${globalConfig.vblog.updateArticle}`,
    method: 'post',
    data: article
  })
}
export function saveArticle(article) {
  return request({
    url: `${globalConfig.getAPIPath()}${globalConfig.vblog.saveArticle}`,
    method: 'post',
    data: article
  })
}

export function listArchives() {
  return request({
    url: '/article/archives',
    method: 'get'
  })
}


